package clearsyntax.collection;

import static clearsyntax.collection.Util.addAll;
import static clearsyntax.collection.Util.putAll;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.SortedMap;
import java.util.SortedSet;
import java.util.TreeMap;
import java.util.TreeSet;

import clearsyntax.types.Tuple2;

public final class mutable {

	public static <T> T[] Array(T... elems) {
		return elems;
	}

	public static <T> List<T> List(T... elems) {
		return addAll(new ArrayList<T>(), elems);
	}

	public static <T> Set<T> Set(T... elems) {
		return addAll(new HashSet<T>(), elems);
	}

	public static <T> SortedSet<T> SortedSet(T... elems) {
		return addAll(new TreeSet<T>(), elems);
	}

	public static <K, V> Map<K, V> Map(Tuple2<K, V>... entries) {
		return putAll(new HashMap<K, V>(), entries);
	}

	public static <K, V> SortedMap<K, V> SortedMap(Tuple2<K, V>... entries) {
		return putAll(new TreeMap<K, V>(), entries);
	}

}
